package com.zhipu.balance.pop

import android.text.TextUtils
import android.widget.Button
import android.widget.EditText
import android.widget.LinearLayout
import com.blankj.utilcode.util.ActivityUtils
import com.lxj.xpopup.core.CenterPopupView
import com.zhipu.balance.R
import com.zhipu.balance.listener.AddOnClickListener
import com.zhipu.balance.utils.InitializeUtils

/**
 * 编号
 */
class AddNumberPopup(var mAddOnClickListener : AddOnClickListener)  : CenterPopupView(ActivityUtils.getTopActivity()){

    override fun getImplLayoutId(): Int {
        return R.layout.popup_add_number
    }


    override fun onCreate() {
        super.onCreate()
        var NameTester = findViewById<EditText>(R.id.NameTester)
        /**
         * 关闭
         */
        findViewById<Button>(R.id.Cancel).setOnClickListener {
            dismiss()
        }

        /**
         * 确认添加
         */
        findViewById<Button>(R.id.ConfirmAdd).setOnClickListener {
            if(TextUtils.isEmpty(NameTester.text.toString())){
                InitializeUtils.getDefaultMaker()?.show("请输入编号")
                return@setOnClickListener
            }
            mAddOnClickListener.onSkipClicked(NameTester.text.toString())
            dismiss()
        }
    }
}